import openpyxl
import sys

# 根据配置信息生成操作对象
# 定义要执行的sql %s为占位符
# sql = "INSERT INTO model_index_unit(table_name, field_id, field_tb, field_hb, field_name, field_unit)  VALUES ('%s','%s','%s','%s','%s','%s');"
sql = "update metric_metadata set metric_name = '%s' where   metric_name = '%s' ;"
#sql ="select count(1),'%s' from s2_dimension where name = '%s' ;"
workbook = openpyxl.load_workbook('data.xlsx')

sheet = workbook["Sheet4"]
# sheet = workbook["hb_ai_pre_table"]
didi = {}
count = 0
for one_column_data in sheet.iter_rows():
    row_data = []
    row_data.append(one_column_data[1].value)
    row_data.append(one_column_data[0].value)
    #row_data.append(one_column_data[2].value)
    val = tuple(row_data)
    print(sql % val)
